.class Les/o7$c;
.super Ljava/lang/Object;
.source "MediaEncoder.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Les/o7;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "c"
.end annotation


# instance fields
.field private a:Z

.field final synthetic b:Les/o7;


# direct methods
.method private constructor <init>(Les/o7;)V
    .locals 0

    .line 1
    iput-object p1, p0, Les/o7$c;->b:Les/o7;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 p1, 0x0

    .line 2
    iput-boolean p1, p0, Les/o7$c;->a:Z

    return-void
.end method

.method synthetic constructor <init>(Les/o7;Les/o7$a;)V
    .locals 0

    .line 3
    invoke-direct {p0, p1}, Les/o7$c;-><init>(Les/o7;)V

    return-void
.end method

.method private a()V
    .locals 8

    .line 1
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    iget-boolean v0, v0, Les/o7;->s:Z

    if-eqz v0, :cond_d

    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    iget-object v1, v0, Les/o7;->t:Ljava/lang/Exception;

    if-nez v1, :cond_d

    iget-boolean v1, v0, Les/o7;->j:Z

    if-eqz v1, :cond_0

    goto/16 :goto_3

    .line 2
    :cond_0
    iget-boolean v0, v0, Les/o7;->i:Z

    if-eqz v0, :cond_1

    const/16 v0, 0xa

    goto :goto_0

    :cond_1
    const/4 v0, 0x5

    :goto_0
    const/4 v1, 0x0

    const/4 v2, 0x0

    .line 3
    :cond_2
    :goto_1
    :try_start_0
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    iget-boolean v3, v3, Les/o7;->s:Z

    if-eqz v3, :cond_d

    .line 4
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    iget-object v3, v3, Les/o7;->t:Ljava/lang/Exception;

    if-eqz v3, :cond_3

    .line 5
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    const-string v1, "has error ..."

    invoke-virtual {v0, v1}, Les/o7;->a(Ljava/lang/String;)V

    return-void

    .line 6
    :cond_3
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    iget-object v3, v3, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    iget-object v4, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v4}, Les/o7;->h(Les/o7;)Landroid/media/MediaCodec$BufferInfo;

    move-result-object v4

    const-wide/32 v5, 0xc350

    invoke-virtual {v3, v4, v5, v6}, Lcom/esfile/screen/recorder/media/util/n;->a(Landroid/media/MediaCodec$BufferInfo;J)I

    move-result v3

    const/4 v4, -0x1

    const/4 v5, 0x1

    if-ne v3, v4, :cond_4

    add-int/lit8 v2, v2, 0x1

    if-le v2, v0, :cond_2

    .line 7
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    iget-boolean v0, v0, Les/o7;->i:Z

    if-eqz v0, :cond_d

    .line 8
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    const-string v1, "stop wait eos. saw out eos."

    invoke-virtual {v0, v1}, Les/o7;->a(Ljava/lang/String;)V

    .line 9
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    iput-boolean v5, v0, Les/o7;->j:Z

    .line 10
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v0}, Les/o7;->i(Les/o7;)V

    .line 11
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    invoke-virtual {v0}, Les/o7;->m()V

    goto/16 :goto_3

    :cond_4
    const/4 v4, -0x2

    if-ne v3, v4, :cond_6

    .line 12
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    const-string v4, "INFO_OUTPUT_FORMAT_CHANGED"

    invoke-virtual {v3, v4}, Les/o7;->a(Ljava/lang/String;)V

    .line 13
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    iget-object v3, v3, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    invoke-virtual {v3}, Lcom/esfile/screen/recorder/media/util/n;->g()Landroid/media/MediaFormat;

    move-result-object v3

    .line 14
    iget-object v4, p0, Les/o7$c;->b:Les/o7;

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "output format:"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v6, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v4, v6}, Les/o7;->a(Ljava/lang/String;)V

    .line 15
    iget-boolean v4, p0, Les/o7$c;->a:Z

    if-nez v4, :cond_5

    .line 16
    iput-boolean v5, p0, Les/o7$c;->a:Z

    .line 17
    iget-object v4, p0, Les/o7$c;->b:Les/o7;

    iget-object v5, p0, Les/o7$c;->b:Les/o7;

    invoke-virtual {v5, v3}, Les/o7;->b(Landroid/media/MediaFormat;)I

    move-result v3

    invoke-static {v4, v3}, Les/o7;->a(Les/o7;I)I

    .line 18
    :cond_5
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    const-string v4, "INFO_OUTPUT_FORMAT_CHANGED out"

    invoke-virtual {v3, v4}, Les/o7;->a(Ljava/lang/String;)V

    goto/16 :goto_1

    :cond_6
    if-gez v3, :cond_7

    const-string v4, "mer"

    .line 19
    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "drain:unexpected result from encoder#dequeueOutputBuffer: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v4, v3}, Lcom/esfile/screen/recorder/media/util/k;->d(Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_1

    .line 20
    :cond_7
    iget-object v4, p0, Les/o7$c;->b:Les/o7;

    iget-object v4, v4, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    invoke-virtual {v4, v3}, Lcom/esfile/screen/recorder/media/util/n;->b(I)Ljava/nio/ByteBuffer;

    move-result-object v4

    if-eqz v4, :cond_b

    .line 21
    iget-object v6, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v6}, Les/o7;->h(Les/o7;)Landroid/media/MediaCodec$BufferInfo;

    move-result-object v6

    iget v6, v6, Landroid/media/MediaCodec$BufferInfo;->flags:I

    and-int/lit8 v6, v6, 0x2

    if-eqz v6, :cond_8

    .line 22
    iget-object v6, p0, Les/o7$c;->b:Les/o7;

    const-string v7, "drain:BUFFER_FLAG_CODEC_CONFIG"

    invoke-virtual {v6, v7}, Les/o7;->a(Ljava/lang/String;)V

    .line 23
    iget-object v6, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v6}, Les/o7;->a(Les/o7;)Z

    move-result v6

    if-eqz v6, :cond_8

    .line 24
    iget-object v6, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v6}, Les/o7;->h(Les/o7;)Landroid/media/MediaCodec$BufferInfo;

    move-result-object v6

    iput v1, v6, Landroid/media/MediaCodec$BufferInfo;->size:I

    .line 25
    :cond_8
    iget-object v6, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v6}, Les/o7;->h(Les/o7;)Landroid/media/MediaCodec$BufferInfo;

    move-result-object v6

    iget v6, v6, Landroid/media/MediaCodec$BufferInfo;->size:I

    if-eqz v6, :cond_9

    .line 26
    iget-object v2, p0, Les/o7$c;->b:Les/o7;

    iget-object v6, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v6}, Les/o7;->h(Les/o7;)Landroid/media/MediaCodec$BufferInfo;

    move-result-object v6

    invoke-virtual {v2, v3, v4, v6}, Les/o7;->a(ILjava/nio/ByteBuffer;Landroid/media/MediaCodec$BufferInfo;)V

    const/4 v2, 0x0

    goto :goto_2

    .line 27
    :cond_9
    iget-object v4, p0, Les/o7$c;->b:Les/o7;

    iget-object v4, v4, Les/o7;->k:Lcom/esfile/screen/recorder/media/util/n;

    invoke-virtual {v4, v3, v1}, Lcom/esfile/screen/recorder/media/util/n;->a(IZ)V

    .line 28
    :goto_2
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v3}, Les/o7;->h(Les/o7;)Landroid/media/MediaCodec$BufferInfo;

    move-result-object v3

    iget v3, v3, Landroid/media/MediaCodec$BufferInfo;->flags:I

    and-int/lit8 v3, v3, 0x4

    if-eqz v3, :cond_a

    .line 29
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    const-string v1, "saw out eos."

    invoke-virtual {v0, v1}, Les/o7;->a(Ljava/lang/String;)V

    .line 30
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    iput-boolean v5, v0, Les/o7;->j:Z

    .line 31
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v0}, Les/o7;->b(Les/o7;)V

    .line 32
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    invoke-virtual {v0}, Les/o7;->m()V

    goto :goto_3

    .line 33
    :cond_a
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v3}, Les/o7;->h(Les/o7;)Landroid/media/MediaCodec$BufferInfo;

    move-result-object v3

    iget v3, v3, Landroid/media/MediaCodec$BufferInfo;->size:I

    if-eqz v3, :cond_2

    .line 34
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v3}, Les/o7;->c(Les/o7;)V

    .line 35
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    iget-boolean v3, v3, Les/o7;->i:Z

    if-nez v3, :cond_2

    goto :goto_3

    .line 36
    :cond_b
    new-instance v0, Ljava/lang/RuntimeException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "encoderOutputBuffer "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v2, " was null"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :catch_0
    move-exception v0

    .line 37
    instance-of v1, v0, Landroid/media/MediaCodec$CodecException;

    if-eqz v1, :cond_c

    .line 38
    move-object v1, v0

    check-cast v1, Landroid/media/MediaCodec$CodecException;

    .line 39
    iget-object v2, p0, Les/o7$c;->b:Les/o7;

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "drainOutputBuffer error isTransient:"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 40
    invoke-virtual {v1}, Landroid/media/MediaCodec$CodecException;->isTransient()Z

    move-result v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    const-string v4, " isRecoverable:"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Landroid/media/MediaCodec$CodecException;->isRecoverable()Z

    move-result v1

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 41
    invoke-virtual {v2, v1}, Les/o7;->a(Ljava/lang/String;)V

    .line 42
    :cond_c
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 43
    iget-object v1, p0, Les/o7$c;->b:Les/o7;

    iget-boolean v2, v1, Les/o7;->i:Z

    if-nez v2, :cond_d

    .line 44
    new-instance v2, Ljava/lang/Exception;

    const-string v3, "drainOutputBuffer error"

    invoke-direct {v2, v3, v0}, Ljava/lang/Exception;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    invoke-virtual {v1, v2}, Les/o7;->b(Ljava/lang/Exception;)V

    :cond_d
    :goto_3
    return-void
.end method


# virtual methods
.method public run()V
    .locals 5

    .line 1
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    iget-object v0, v0, Les/o7;->f:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_0
    iget-object v1, p0, Les/o7$c;->b:Les/o7;

    const/4 v2, 0x1

    invoke-static {v1, v2}, Les/o7;->b(Les/o7;Z)Z

    .line 3
    iget-object v1, p0, Les/o7$c;->b:Les/o7;

    iget-object v1, v1, Les/o7;->f:Ljava/lang/Object;

    invoke-virtual {v1}, Ljava/lang/Object;->notifyAll()V

    .line 4
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_3

    .line 5
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    invoke-virtual {v0}, Les/o7;->j()V

    :cond_0
    :goto_0
    const/4 v0, 0x0

    .line 6
    :try_start_1
    iget-object v1, p0, Les/o7$c;->b:Les/o7;

    iget-object v1, v1, Les/o7;->f:Ljava/lang/Object;

    monitor-enter v1
    :try_end_1
    .catch Ljava/lang/InterruptedException; {:try_start_1 .. :try_end_1} :catch_0

    .line 7
    :goto_1
    :try_start_2
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    iget-boolean v3, v3, Les/o7;->h:Z

    if-nez v3, :cond_1

    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v3}, Les/o7;->e(Les/o7;)I

    move-result v3

    if-gtz v3, :cond_1

    .line 8
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    iget-object v3, v3, Les/o7;->f:Ljava/lang/Object;

    invoke-virtual {v3}, Ljava/lang/Object;->wait()V

    goto :goto_1

    .line 9
    :cond_1
    iget-object v3, p0, Les/o7$c;->b:Les/o7;

    iget-boolean v3, v3, Les/o7;->h:Z

    .line 10
    iget-object v4, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v4}, Les/o7;->e(Les/o7;)I

    move-result v4

    if-lez v4, :cond_2

    const/4 v4, 0x1

    goto :goto_2

    :cond_2
    const/4 v4, 0x0

    .line 11
    :goto_2
    monitor-exit v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    if-eqz v3, :cond_4

    .line 12
    :try_start_3
    invoke-direct {p0}, Les/o7$c;->a()V

    .line 13
    iget-object v1, p0, Les/o7$c;->b:Les/o7;

    iget-object v1, v1, Les/o7;->f:Ljava/lang/Object;

    monitor-enter v1
    :try_end_3
    .catch Ljava/lang/InterruptedException; {:try_start_3 .. :try_end_3} :catch_0

    .line 14
    :goto_3
    :try_start_4
    iget-object v2, p0, Les/o7$c;->b:Les/o7;

    iget-boolean v2, v2, Les/o7;->i:Z

    if-nez v2, :cond_3

    .line 15
    iget-object v2, p0, Les/o7$c;->b:Les/o7;

    iget-object v2, v2, Les/o7;->f:Ljava/lang/Object;

    const-wide/16 v3, 0xa

    invoke-virtual {v2, v3, v4}, Ljava/lang/Object;->wait(J)V

    goto :goto_3

    .line 16
    :cond_3
    monitor-exit v1
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0

    .line 17
    :try_start_5
    invoke-direct {p0}, Les/o7$c;->a()V
    :try_end_5
    .catch Ljava/lang/InterruptedException; {:try_start_5 .. :try_end_5} :catch_0

    goto :goto_4

    :catchall_0
    move-exception v2

    .line 18
    :try_start_6
    monitor-exit v1
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_0

    :try_start_7
    throw v2

    :cond_4
    if-eqz v4, :cond_0

    .line 19
    invoke-direct {p0}, Les/o7$c;->a()V
    :try_end_7
    .catch Ljava/lang/InterruptedException; {:try_start_7 .. :try_end_7} :catch_0

    goto :goto_0

    :catchall_1
    move-exception v2

    .line 20
    :try_start_8
    monitor-exit v1
    :try_end_8
    .catchall {:try_start_8 .. :try_end_8} :catchall_1

    :try_start_9
    throw v2
    :try_end_9
    .catch Ljava/lang/InterruptedException; {:try_start_9 .. :try_end_9} :catch_0

    .line 21
    :catch_0
    :goto_4
    iget-object v1, p0, Les/o7$c;->b:Les/o7;

    const-string v2, "Encoder thread exiting"

    invoke-virtual {v1, v2}, Les/o7;->a(Ljava/lang/String;)V

    .line 22
    iget-object v1, p0, Les/o7$c;->b:Les/o7;

    iget-object v1, v1, Les/o7;->f:Ljava/lang/Object;

    monitor-enter v1

    .line 23
    :try_start_a
    iget-object v2, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v2, v0}, Les/o7;->b(Les/o7;Z)Z

    .line 24
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    iget-object v0, v0, Les/o7;->f:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 25
    monitor-exit v1
    :try_end_a
    .catchall {:try_start_a .. :try_end_a} :catchall_2

    .line 26
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    invoke-static {v0}, Les/o7;->f(Les/o7;)V

    .line 27
    iget-object v0, p0, Les/o7$c;->b:Les/o7;

    iget-object v1, v0, Les/o7;->t:Ljava/lang/Exception;

    if-eqz v1, :cond_5

    .line 28
    invoke-static {v0, v1}, Les/o7;->a(Les/o7;Ljava/lang/Exception;)V

    goto :goto_5

    .line 29
    :cond_5
    invoke-static {v0}, Les/o7;->g(Les/o7;)V

    :goto_5
    return-void

    :catchall_2
    move-exception v0

    .line 30
    :try_start_b
    monitor-exit v1
    :try_end_b
    .catchall {:try_start_b .. :try_end_b} :catchall_2

    throw v0

    :catchall_3
    move-exception v1

    .line 31
    :try_start_c
    monitor-exit v0
    :try_end_c
    .catchall {:try_start_c .. :try_end_c} :catchall_3

    goto :goto_7

    :goto_6
    throw v1

    :goto_7
    goto :goto_6
.end method
